package com.zxf.appliction.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zxf.appliction.dao.ColumnsMapper;
import com.zxf.appliction.domain.Columns;
import com.zxf.appliction.domain.Params;


@Service  
//默认将类中的所有函数纳入事务管理.  
@Transactional  
public class ColumnService {
	
	 
	    @Autowired  
	    private ColumnsMapper columnMapper;  
	    
	    
	  
	 public void insertUser(Columns column) {  
	        //新增用户  
		 columnMapper.insert(column);  
	 }

	public Columns getId(int userid) {
		return columnMapper.selectByPrimaryKey(userid);
	}

	public List getUserList() {
		// 用户列表
		return columnMapper.getColumnList();
	}

	public Map getUserList2() {
		return columnMapper.getColumnJson();
	}

	public List getColumnlist() {
		return columnMapper.getColumnList();
	}

	public List findLeaf(int parentID) {
		return columnMapper.findLeaf(parentID);
	}

	public List getColumnsList(Params params) {
		return columnMapper.getColumnsList(params);
	}

	//删除菜单
	public int delColumn(List channelIDList) {
		 Map<String, Object> map = new HashMap<String, Object>();  
		    map.put("channelIDList", channelIDList);  
		return columnMapper.delColumn(map);
	}
//级联菜单
	public List findColumnLeaf(int parentID, int leaf) {
		return columnMapper.findColumnLeaf(parentID,leaf);
	}
	//级联菜单
	public List findColumnLeaf(Map paramsmap) {
		return columnMapper.findColumnLeaf(paramsmap);
	}
    //总数
	public int getcolumntotle(Params params) {
		return columnMapper.getcolumntotle(params);
	}
//获取id列表
	public List getchannelIDs(int delno) {
		return columnMapper.getchannelIDs(delno);
	}
// 获取菜单信息
	public Columns getColumnbyid(int channelID) {
		return columnMapper.selectByPrimaryKey(channelID);
		
	}
}
